<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <div>
        <img src="../images/l1.jpg" alt="">
        <input type="button" value="全屏" id="full">
        <input type="button" value="退出全屏" id="cancelFull">
        <input type="button" value="是否全屏" id="isFull">
    </div>


    <script>

        window.onload = function () {
            var div = document.querySelector('div');
            document.querySelector('#full').onclick = function () {
                if (div.requestFullscreen) {
                    div.requestFullscreen();
                }
                else if (div.webkitRequestFullscreen) {
                    div.webkitRequestFullscreen();
                }
                else if (div.mozRequestFullscreen) {
                    div.mozRequestFullscreen();
                }
                else if (div.msRequestFullscreen) {
                    div.msRequestFullscreen();
                }
            }
            document.querySelector('#cancelFull').onclick = function () {
                if (document.exitFullScreen) {
                    console.log(111111);
                    document.exitFullscreen();
                }
                else if (document.webkitCancelFullScreen) {
                    document.webkitCancelFullScreen();
                    console.log(222222222);

                }
                else if (document.mozCancelFullScreen) {
                    document.mozCancelFullScreen();
                    console.log(333333333333);
                }
                else if (document.msCancelFullscreen) {
                    document.msCancelFullscreen();
                    console.log(4444444444);
                }

            }
            document.querySelector('#isFull').onclick = function () {

                if (document.fullscreenElement
                    || document.webkitFullscreenElement
                    || document.mozfullScreenElement
                    || document.msFullscreenElement) {
                    alert('true')
                } else {
                    alert('fales')

                }
            }

        }





    </script>


</body>

</html>